package com.ydc.ln.tutorial.algorithm.work.zjh;

/**
 * 递归,abc,acb,bac,bca,cab,cba
 * 
 * @author ydc
 * @date 下午4:56:46 2013-6-26
 */
public class Ch03 {
    public static void main(String[] args) {
        Ch03.test("abc", "");
    }

    public static void test(String str1, String str2) {
        int len1 = str1.length();
        if (len1 == 0) {
            System.out.println(str2);
        } else {
            for (int i = 0; i < len1; i++) {
                test(str1.substring(0, i) + str1.substring(i + 1, len1), str2
                        + str1.charAt(i));
            }
        }
    }
}
